package com.example.back.controller;

import com.example.back.model.Accommodation;
import com.example.back.model.Post;
import com.example.back.service.AccommodationService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author : 贾媛晴
 * @createTime : 2022/5/2 14:08
 */
@RestController
@Api(tags = "AccommodationController")
@CrossOrigin //允许跨域
public class AccommodationController {

    @Autowired
    AccommodationService accommodationService;

    @GetMapping("/Accommodation")
    public List<Accommodation> selectAll(){
        List<Accommodation> accommodationList = this.accommodationService.selectAll();
        return accommodationList;
    }
    // 取出 详情页 的数据
    @GetMapping("/Accommodation_Detail")
    public Accommodation selectDetail(String itemId){
        Accommodation detail=this.accommodationService.selectDetail(itemId);
        return detail;
    }
}
